//
//  CHPartViewCell.m
//  CarFile
//
//  Created by 陈浩 on 2017/8/4.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHPartViewCell.h"

@interface CHPartViewCell ()

@property (nonatomic ,strong) UILabel *nameResutlLabel;
@property (nonatomic ,strong) UILabel *partResultLabel;
@property (nonatomic ,strong) UILabel *numResultLabel;
@end

@implementation CHPartViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}



+(instancetype)cellForTableView:(UITableView *)tableView{
    static NSString *ID = @"CHPartViewCell";
    CHPartViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[CHPartViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

        self.backgroundColor = [UIColor colorWithHexString:@"eeeef0" alpha:1];
        
        
        [self setupUI];
    }
    return self;
    
}

-(void)setupUI{
    
    UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, 40)];
    nameLabel.text = @"维修配件名称";
    nameLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:nameLabel];
    
    UILabel *nameResutlLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(nameLabel.frame), 0, UIScreenW - 120, 40)];
    nameResutlLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:nameResutlLabel];
    nameResutlLabel.numberOfLines = 0;
    nameResutlLabel.textAlignment = NSTextAlignmentRight;
    self.nameResutlLabel = nameResutlLabel;
    
    UILabel *partLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 100, 40)];
    partLabel.text = @"维修配件编码";
    partLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:partLabel];
    
    UILabel *partResultLabel = [[UILabel alloc] initWithFrame:CGRectMake(nameResutlLabel.x, 40, nameResutlLabel.w, 40)];
    partResultLabel.textAlignment = NSTextAlignmentRight;
    partResultLabel.numberOfLines = 0;
    partResultLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:partResultLabel];
    self.partResultLabel = partResultLabel;
    
    
    UILabel *numLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 80, 100, 40)];
    numLabel.text = @"维修配件数量";
    numLabel.font = [UIFont systemFontOfSize:14];
    [self addSubview:numLabel];
    
    UILabel *numResultLabel = [[UILabel alloc] initWithFrame:CGRectMake(nameResutlLabel.x, 80, nameResutlLabel.w, 40)];
    numResultLabel.textAlignment = NSTextAlignmentRight;
    numResultLabel.font = [UIFont systemFontOfSize:14];
    numResultLabel.numberOfLines = 0;
    [self addSubview:numResultLabel];
    self.numResultLabel = numResultLabel;
}

- (void)setModel:(PartsModel *)model{
    _model = model;
    
    self.nameResutlLabel.text = model.partsname;
    self.partResultLabel.text = model.partsno;
    self.numResultLabel.text = model.partsquantity;
    
}




@end
